package com.jwsoft.manager.core.gateway.controller;

import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.jwsoft.manager.common.vo.eduSchool.EduSchoolVO;
import com.jwsoft.manager.common.vo.eduSchoolTj.StudentEnrollTjVO;
import com.jwsoft.manager.core.integration.EduSchoolTjParamsJhIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 学校调剂参数管理网关
 *
 * @author chenzh
 * @since 2023-07-04
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "学校调剂参数管理-金华模式", description = "学校调剂参数管理")
public class EduSchoolTjParamsJhController {

    @Autowired
    public EduSchoolTjParamsJhIntegration eduSchoolTjParamsJhIntegration;

    @Operation(summary = "根据学校id查询可调剂学校", description = "根据学校id查询可调剂学校")
    @PostMapping(value = "/eduSchoolTjParamsJh0007", produces = "application/json;charset=UTF-8")
    public AppResponse<List<EduSchoolVO>> getListBySchoolId(@RequestBody @Validated EduSchoolVO vo) {
        return AppResponse.successData(eduSchoolTjParamsJhIntegration.getListBySchoolId(vo));
    }
    @Idempotent(expire = "PT2S") //2秒内防重复提交
    @Operation(summary = "义务教育学校调剂保存", description = "义务教育学校调剂保存")
    @PostMapping(value = "/eduSchoolTjParamsJh0008", produces = "application/json;charset=UTF-8")
    public AppResponse schoolTj(@RequestBody @Validated StudentEnrollTjVO vo) {
        eduSchoolTjParamsJhIntegration.schoolTj(vo);
        return AppResponse.success();
    }
}
